package com.itfreer.gis.map.resource.entity;

import java.io.Serializable;

import com.itfreer.form.api.entity.EntityBase;
import com.itfreer.utils.file.FileMeta;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * 栅格数据
 */
@Entity(name = "gis_custom_data")
public class CustomDataEntity extends EntityBase implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * Id
	 */
	@Id
	@Column(name = "id", length = 50, nullable = true)
	private String id;

	/**
	 * 数据名称
	 */
	@Column(name = "s_name", length = 255, nullable = true)
	private String name = "";

	/**
	 * 数据类型
	 */
	@Column(name = "s_type", length = 20, nullable = true)
	private String type;

	/**
	 * 数据源
	 */
	@Column(name = "s_source", columnDefinition = "text", nullable = true)
	private String source;

	/**
	 * 数据格式
	 */
	@Column(name = "s_format", length = 255, nullable = true)
	private String format = "";

	/**
	 * 租户ID
	 */
	@Column(name = "s_tenantid", length = 50, nullable = true)
	private String tenantID;

	/**
	 * 租户名称
	 */
	@Column(name = "s_tenantname", length = 50, nullable = true)
	private String tenantName;

	/**
	 * 共享租户ID
	 */
	@Column(name = "s_shareTenantID", nullable = true, columnDefinition = "text")
	private String shareTenantID;

	/**
	 *
	 */
	public String getId() {
		return id;
	}

	/**
	 *
	 */
	public void setId(String value) {
		this.id = value;
	}

	/**
	 *
	 */
	public String getName() {
		return getSource()[0].getName();
	}

	/**
	 *
	 */
	public void setName(String value) {
		this.name = value;
	}

	/**
	 *
	 */
	public String getType() {
		return type;
	}

	/**
	 *
	 */
	public void setType(String value) {
		this.type = value;
	}

	/**
	 *
	 */
	public FileMeta[] getSource() {
		return super.getFileArray(this.source);

	}

	/**
	 *
	 */
	public void setSource(FileMeta[] value) {
		this.source = super.getFileString(value);

	}

	/**
	 *
	 */
	public String getFormat() {
		return getSource()[0].getType();
	}

	/**
	 *
	 */
	public void setFormat(String value) {
		this.format = value;
	}

	public String getTenantID() {
		return tenantID;
	}

	public void setTenantID(String tenantID) {
		this.tenantID = tenantID;
	}

	public String getTenantName() {
		return tenantName;
	}

	public void setTenantName(String tenantName) {
		this.tenantName = tenantName;
	}

	@Override
	public String getShareTenantID() {
		return shareTenantID;
	}

	@Override
	public void setShareTenantID(String shareTenantID) {
		this.shareTenantID = shareTenantID;
	}
}
